function Compartment_Menu(parameters)
{
  this.container = $('#' + parameters['container']);
  this.active_menu = 0;
  this.menu = new Array();
  this.set_base_parameters(this);
  this.rotate_text();
  this.restructer(0);
}

Compartment_Menu.prototype.set_base_parameters = function(self)
{
  for ( var i in self.container[0].children )
  {
    if ( self.container[0].children[i].tagName != undefined )
    {
      var temp = new Array();
      temp['id'] = self.container[0].children[i].id;
      temp['items'] = new Array();
      for ( var z in self.container[0].children[i].children )
      {
        if ( self.container[0].children[i].children[z].tagName != undefined )
        {
          temp['items'].push(self.container[0].children[i].children[z]);
        }
      }
      self.menu.push(temp);
    }
  }
}

Compartment_Menu.prototype.restructer = function(menu_number)
{
  this.active_menu = menu_number;
  //Активируем область данных, подменю, заменяем + на -
  this.menu[this.active_menu].items[1].style['display'] = 'block';
  this.menu[this.active_menu].items[0].children[0].innerHTML = '-';
  $('#' + this.menu[this.active_menu].items[0].children[1].id).show('1000');
  //Деактивируем все остальное
  for ( var i = 0; i < this.menu.length; ++i )
  {
    if ( i != this.active_menu )
    {
      this.menu[i].items[1].style['display'] = 'none';
      this.menu[i].items[0].children[0].innerHTML = '+';
      $('#' + this.menu[i].items[0].children[1].id).hide('1000');
    }
  }
}

Compartment_Menu.prototype.rotate_text = function()
{
  var rot = 'rotate(-90deg)';
  $('.menu_text').css('transform', rot);
  $('.menu_text').css('-webkit-transform', rot );
  $('.menu_text').css('-o-transform', rot );
  $('.menu_text').css('-moz-transform', rot);
}

var compartment = new Object();

$(document).ready( function()
                   {
                     compartment = new Compartment_Menu({'container':'compartment_container'})
                   }
                 );